package unit5.part11;

import java.util.Objects;

public class Employee {
    String no;
    String name;
    float salary;
    String department;

    public Employee(String no, String name, float salary, String department) {
        this.no = no;
        this.name = name;
        this.salary = salary;
        this.department = department;
    }

    @Override
    public String toString() {
        return "工号：" + no + "，姓名：" + name + "，部门：" + department + "薪水：" + salary;
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;
        Employee employee = (Employee) o;
        return Objects.equals(no, employee.no);
    }

    @Override
    public int hashCode() {
        return Objects.hash(no, name, salary, department);
    }
}
